#include <bits/stdc++.h>

using namespace std;

int main() {
    long long k;
    cin >> k;
    while (k--) {
        long long n,e,d;
        cin >> n >> e >> d;
        long long pq = sqrt((n - e * d + 2) * (n - e * d + 2) - (n * 4));
        long long qp = n - e * d + 2;
        long long p = (pq + qp) / 2;
        long long q = qp - p;
        if (p * q == n && e * d == (p - 1) * (q - 1) + 1 && p && q) {
            cout << min(p, q) << " " << max(p, q) << endl;
        }
        else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

